<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Browse.aspx.cs" Inherits="MOM.Browse" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<script type="text/javascript" language="javascript" src="Js/jquery-1.2.6.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery.flydom-3.1.0.js"></script>
	<script type="text/javascript" language="javascript" src="Js/jquery.contextmenu.r2.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Common.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Meta.js"></script>
	<script type="text/javascript" language="javascript" src="Js/KeyHandler.js"></script>
	<script type="text/javascript" language="javascript" src="Js/Translate_<%=Lang %>.js"></script>
	<script type="text/javascript" language="javascript">
		var _CurrentTheme = '<%= MOMTheme %>';
		var MashUpOn = false;
		var MashUpLoaded = false;
				
		$(document).ready(function ()
		{
			var type = GetQueryString("t");
			var id = GetQueryString("id");
			var selector = '.Box';
			if ("<%= _Mode %>" == "simple")
				selector = 'tr';
			
			if (type != null && type == "artist" && id == null)
			{				
				$(selector).each(
					function (i, n)
					{
						if (n.id.length > 0 && n.id.indexOf("Artist_") > -1)
						{
							$(this).contextMenu('BrowsingMenu', 
							{
								bindings:
								{
									'queueall':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), -1);},
									'queue1':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), 1);},
									'queue2':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), 2);},
									'queue3':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), 3);},
									'queue4':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), 4);},
									'queue5':function() {top.MOM.PlayArtist(parseInt(n.id.substr(7)), 5);}
								}
							});
						}
					}
				);
			}
			else if (type != null && type == "album")
			{				
				$(selector).each(
					function (i, n)
					{
						if (n.id.length > 0 && n.id.indexOf("Album_") > -1)
						{
							$(this).contextMenu('BrowsingMenu', 
							{
								bindings:
								{
									'queueall':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), -1);},
									'queue1':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), 1);},
									'queue2':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), 2);},
									'queue3':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), 3);},
									'queue4':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), 4);},
									'queue5':function() {top.MOM.PlayAlbum(parseInt(n.id.substr(6)), 5);}
								}
							});
						}
					}
				);	
			}
			
			$("tr:odd", "tbody").addClass("Alternate");	
		});
		
		function ResetPage()
		{
			var pages = document.getElementById("<%=ddlPage.ClientID %>");
			if (pages.options.length > 0)
				pages.options[0].selected = true;
		}
		
		function SwitchMashUp(link)
		{
			if (!MashUpOn)
			{
				$(link).text("-");
				$("#Mashup").css("display", "block");
				if (!MashUpLoaded)
					LoadCompleteMetaDataForArtist(CurrentArtist);
				MashUpOn = true; MashUpLoaded = true;
			}
			else
			{
				$(link).text("+");
				$("#Mashup").css("display", "none");
				MashUpOn = false;
			}
		}		
	</script>
	<style type="text/css">
		@import url(Css/Mom.css);
		@import url(Css/themes/<%=MOMTheme %>.css);
	</style>
</head>
<body class="Iframe">
<form runat="server">
	<h1 id="heading" visible="false" runat="server"></h1>
		
	<div id="BrowsingMenu" class="contextMenu">
		<ul>
			<li id="queueall"><%=Translate("queueall") %></li>
			<li id="queue1"><%=Translate("queuerating", 1) %></li>
			<li id="queue2"><%=Translate("queuerating", 2)%></li>
			<li id="queue3"><%=Translate("queuerating", 3)%></li>
			<li id="queue4"><%=Translate("queuerating", 4)%></li>
			<li id="queue5"><%=Translate("queuerating", 5)%></li>
		</ul>
	</div>
			
	<asp:PlaceHolder ID="plhTrack" Visible="false" runat="server">
		<div class="Row SearchBar">
			<div class="FloatLeft">
				<asp:TextBox ID="txtQuery" runat="server"></asp:TextBox>
				<asp:CheckBox ID="cbLyric" runat="server" />
				<asp:Button ID="btnSearch" CssClass="Button" OnClientClick="ResetPage()" runat="server" />
			</div>
			<div class="FloatRight" style="margin-right:5px;">
				<asp:DropDownList ID="ddlPage" AutoPostBack="true" runat="server"></asp:DropDownList>
			</div>
		</div>
	</asp:PlaceHolder>
		
	<asp:PlaceHolder ID="plhHistory" Visible="false" runat="server">
		<div class="HistoryCalendar">
			<div class="Row HistoryYear"><asp:Repeater ID="rptYear" OnItemDataBound="Year_DataBound" runat="server"><ItemTemplate><asp:LinkButton ID="lbYear" CommandName="Year" CommandArgument='<%#(String)Container.DataItem %>' Text='<%#(String)Container.DataItem %>' OnClick="Date_Click" runat="server"></asp:LinkButton></ItemTemplate></asp:Repeater></div>
			<div class="Row HistoryMonth"><asp:Repeater ID="rptMonth" OnItemDataBound="Month_DataBound" runat="server"><ItemTemplate><asp:LinkButton ID="lbMonth" CommandName="Month" CommandArgument='<%#(String)Container.DataItem %>' Text='<%#Translate("month" + (String)Container.DataItem) %>' OnClick="Date_Click" runat="server"></asp:LinkButton></ItemTemplate></asp:Repeater></div>
			<div class="Row HistoryDay"><asp:Repeater ID="rptDay" OnItemDataBound="Day_DataBound" runat="server"><ItemTemplate><asp:LinkButton ID="lbDay" CommandName="Day" CommandArgument='<%#(String)Container.DataItem %>' Text='<%#(String)Container.DataItem %>' OnClick="Date_Click" runat="server"></asp:LinkButton></ItemTemplate></asp:Repeater></div>
		</div>
	</asp:PlaceHolder>
	
	<div class="Row">
	<asp:Repeater ID="rptCommon" EnableViewState="false" runat="server"></asp:Repeater>	
	</div>
	
	<div id="ArtistInfo" visible="false" runat="server">
		<div class="Row">
			<h2><%=Translate("mashup") %></h2>
			<a href="javascript:void(0);" id="MashupSwitch" onclick="SwitchMashUp(this)">+</a>
		</div>
		<div id="Mashup" class="Row" style="display:none;">
			<div id="ArtistWiki">
				<h3>Wikipedia</h3>
			</div>
			<div id="ArtistSimilar">
				<h3><%=Translate("similarartists") %></h3>
			</div>
			<div id="ArtistTopAlbums">
				<h3><%=Translate("topalbums") %></h3>
			</div>
			<div id="ArtistFlickr">
				<h3><%=Translate("flickrimages") %></h3>
			</div>
		</div>
	</div>
</form>
</body></html>